Add Puppet proxy (CA) bulk actions#429
Conversation
adamruzicka
left a comment
There was a problem hiding this comment.
Left some notes inline, can't speak much to the frontend
|
|
||
| api :PUT, "/hosts/bulk/change_puppet_proxy", N_("Change Puppet Proxy") | ||
| param_group :bulk_host_ids | ||
| param :proxy_id, :number, :required => true, :desc => N_("ID of the Puppet proxy to reassign the hosts to") |
There was a problem hiding this comment.
This being required means it can be used to reassign the host to a different proxy, but this cannot be used to unassign it, correct?
There was a problem hiding this comment.
Correct. I have not yet implemented the unassign method, so the implementation details about that one are still open.
| host.puppet_ca_proxy = proxy | ||
| else | ||
| host.puppet_proxy = proxy | ||
| end | ||
| host.save(:validate => false) |
There was a problem hiding this comment.
Do we need callbacks to be run or could we take a shortcut and assign the proxy with a single update query?
There was a problem hiding this comment.
Not sure, if we need callbacks to be honest. The original action does run some validations about validating the proxy I think: https://github.com/theforeman/foreman_puppet/blob/master/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb#L143
Can the update command also take the validate => false parameter?
e2b1c7f to
c7dd83c
Compare
nadjaheitmann
left a comment
There was a problem hiding this comment.
Thanks @adamruzicka !
|
|
||
| api :PUT, "/hosts/bulk/change_puppet_proxy", N_("Change Puppet Proxy") | ||
| param_group :bulk_host_ids | ||
| param :proxy_id, :number, :required => true, :desc => N_("ID of the Puppet proxy to reassign the hosts to") |
There was a problem hiding this comment.
Correct. I have not yet implemented the unassign method, so the implementation details about that one are still open.
| host.puppet_ca_proxy = proxy | ||
| else | ||
| host.puppet_proxy = proxy | ||
| end | ||
| host.save(:validate => false) |
There was a problem hiding this comment.
Not sure, if we need callbacks to be honest. The original action does run some validations about validating the proxy I think: https://github.com/theforeman/foreman_puppet/blob/master/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb#L143
Can the update command also take the validate => false parameter?
ac62ab7 to
e980546
Compare
11c8919 to
4512e86
Compare
4512e86 to
2eb2f1a
Compare
4bb7ef6 to
0faf7d6
Compare
75e0f00 to
7d7c810
Compare
d68caaf to
0caaa68
Compare
jeremylenz
left a comment
There was a problem hiding this comment.
Did a quick read of the frontend code, a couple comments below
|
This PR uses theforeman/foreman@40938e4 , so it will only work with Foreman 3.19+ |
98fdd79 to
dfb9239
Compare
1268415 to
7db72d3
Compare
0c74440 to
44484fc
Compare
adamruzicka
left a comment
There was a problem hiding this comment.
I currently don't have an environment to test this, but code wise it looks good.
44484fc to
f3e13d0
Compare
Thanks @adamruzicka . I accidentally requested another review from you, feel free to ignore that. |
I had a test session with @sbernhard and @Manisha15 . We tested the PR, verified that the permissions work and added a UI warning in case there is no smart proxy with Puppet(CA) feature available:
|
8d0052d to
015a91c
Compare
b143112 to
dc8e586
Compare
Assisted-by: OpenAI Codex <codex@openai.com>
dc8e586 to
70afff5
Compare
|
@adamruzicka We had another internal review and testing round. I would go ahead and merge it if you don't mind. If there are bugs left, we can fix them in a follow-up. |
Assisted-by: OpenAI Codex <codex@openai.com>


@adamruzicka @jeremylenz I have created a draft for the Puppet Proxy update bulk action. It is not more than a draft and I know there is a bunch of things missing (e.g. clearing proxy, CA proxy, tests, ...). I basically took code from Foreman and Katello and mixed it into this. Do you mind checking whether the general approach is the direction we want to go. UI wise, I think this is straight forward, but I was not sure whether
is the way to go.
I appreciate your opinions.